package Java9_9;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Work3 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("cat", "猫");
        map.put("dog", "狗");
        map.put("pig", "猪");
        map.put("fish", "鱼");
        Scanner in = new Scanner(System.in);
        System.out.println("输入英文");
        String i = in.next();
        if (map.containsKey(i)) {
            System.out.println(map.get(i));
        } else {
            System.out.println("没有找到");
        }
        Set<Map.Entry<String, String>> entries = map.entrySet();
        System.out.println("输入中文");
        String s = in.next();
        if (map.containsValue(s)) {
            for (Map.Entry entry : entries) {
                if (entry.getValue().equals(s)) {
                    System.out.println(entry.getKey());
                }
            }
        }else {
            System.out.println("没找到");
        }
    }
}
